// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1

Rectangle {
    width: 480
    height: 700
    color: "#e0e1e2"

    ListView {
        id: list_view1
        x: 0
        y: 0
        width: 480
        height: 767
        contentHeight: 767
        contentWidth: 960
        cacheBuffer: 29
        flickableDirection: Flickable.HorizontalFlick
        boundsBehavior: Flickable.StopAtBounds
        snapMode: ListView.SnapOneItem
        orientation: ListView.Horizontal
        delegate: delegate_test
        model: modeltest
    }

    Component
    {
        id: delegate_test
        Loader
        {
            width: 450
            height: 700

            source:
            {
                switch (index)
                {
                case 0 :
                    "./metropage0.qml";
                    break;
                case 1 :
                    "./metropage1.qml";
                    break;
                }
            }
//            Column
//            {
//                spacing: 10
//                Text
//                {
//                    id: title
//                    text: text_string
//                    font.bold: true
//                    font.underline: true
//                    font.pointSize: 30
//                    color: "white"

//                    width: 400
//                    height: 100
//                }

//                ListView
//                {
//                    x: 0
//                    y: title.y + title.height
//                    width: parent.width
//                    height: parent.height - title.height
//                    spacing: 10
//                    delegate: Item {
//                        x: 5
//                        height: 40
//                        Row {
//                            id: row1
//                            spacing: 10
//                            Rectangle {
//                                width: 40
//                                height: 40
//                                color: colorCode
//                            }

//                            Text {
//                                text: name
//                                anchors.verticalCenter: parent.verticalCenter
//                                font.bold: true
//                                color: colorCode
//                            }
//                        }
//                    }
//                    model:
//                    {
//                        switch (text_string)
//                        {
//                        case "pagemodel_0" :
//                            pagemodel_0;
//                            break;
//                        case "pagemodel_1" :
//                            pagemodel_1;
//                            break;
//                        }
//                    }
//                }
//            }
        }
    }

    ListModel
    {
        id: modeltest
        ListElement
        {
            text_string: "pagemodel_0"
            page_model: "pagemodel_0"
        }

        ListElement
        {
            text_string: "pagemodel_1"
            page_model: "pagemodel_1"
        }

    }

    ListModel
    {
        id: pagemodel_0
        ListElement {
            name: "Red"
            colorCode: "red"
        }

        ListElement {
            name: "Red"
            colorCode: "red"
        }

        ListElement {
            name: "Red"
            colorCode: "red"
        }

        ListElement {
            name: "Red"
            colorCode: "red"
        }

        ListElement {
            name: "Red"
            colorCode: "red"
        }

        ListElement {
            name: "Red"
            colorCode: "red"
        }

        ListElement {
            name: "Red"
            colorCode: "red"
        }

        ListElement {
            name: "Red"
            colorCode: "red"
        }
    }

    ListModel
    {
        id: pagemodel_1
        ListElement {
            name: "blue"
            colorCode: "blue"
        }

        ListElement {
            name: "blue"
            colorCode: "blue"
        }

        ListElement {
            name: "blue"
            colorCode: "blue"
        }

        ListElement {
            name: "blue"
            colorCode: "blue"
        }

        ListElement {
            name: "blue"
            colorCode: "blue"
        }

        ListElement {
            name: "blue"
            colorCode: "blue"
        }

        ListElement {
            name: "blue"
            colorCode: "blue"
        }

        ListElement {
            name: "blue"
            colorCode: "blue"
        }
    }

}
